package com.sc.nft.entity.vo.ecology;

import com.sc.nft.enums.DaoEcologyPointsDetailRecordsTypeEnum;
import com.sc.nft.enums.EcologyHatchShareProfitSeparateAccountTypeEnum;
import com.sc.nft.enums.EcologyHatchShareProfitTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.compress.utils.Lists;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;

@Data
public class AdminEcologyIncomeConfDetailsVO {

    @ApiModelProperty(value = "配置id")
    @NotNull(message = "配置id不能为空")
    private Long confId;

    @ApiModelProperty(value = "类型: SHARE_PROFIT:分享收益 PLATFORM_DIVIDE:平台分红池 DAO_DIVIDE:DAO分红池 RISK_POOL:风控池 TECHNICAL_SERVICE_FEE:技术服务费 BOTH_PARTIES_ACCOUNT:双方分账 MARKET_VALUE_MANAGEMENT:市值管理")
    private EcologyHatchShareProfitTypeEnum type;

    @ApiModelProperty(value = "类型名称")
    private String typeName;

    @ApiModelProperty(value = "双方分账类型")
    private EcologyHatchShareProfitSeparateAccountTypeEnum shareProfitSeparateAccountType;

    @ApiModelProperty(value = "藏品id集合")
    private List<Long> collectionIds= Lists.newArrayList();

    @ApiModelProperty(value = "藏品名称集合")
    private List<String> collectionNames = Lists.newArrayList();

    @ApiModelProperty(value = "品牌DaoId")
    private Long daoId;

    @ApiModelProperty(value = "平台DaoId")
    private Long platformDaoId;

    @ApiModelProperty(value = "分配比例")
    private BigDecimal distributionScale;

    @ApiModelProperty(value = "平台分成比例")
    private BigDecimal platformDivideScale;

    @ApiModelProperty(value = "DAO分成比例")
    private BigDecimal daoDivideIntoScale;

    @ApiModelProperty(value = "品牌拉新人数")
    private Integer daoNewUserNum;

    @ApiModelProperty(value = "服务中心拉新人数")
    private Integer serviceCenterNewUserNum;

    @ApiModelProperty(value = "共振品牌分成比例")
    private BigDecimal resonanceDaoDivideIntoScale;

    @ApiModelProperty(value = "共振服务中心dao分成比例")
    private BigDecimal resonanceServiceCenterDaoDivideIntoScale;

    public void setDistributionScale(BigDecimal distributionScale) {
        this.distributionScale = distributionScale.setScale(2,BigDecimal.ROUND_DOWN);
    }

    public void setPlatformDivideScale(BigDecimal platformDivideScale) {
        this.platformDivideScale = platformDivideScale.setScale(2,BigDecimal.ROUND_DOWN);
    }

    public void setDaoDivideIntoScale(BigDecimal daoDivideIntoScale) {
        this.daoDivideIntoScale = daoDivideIntoScale.setScale(2,BigDecimal.ROUND_DOWN);
    }

    public void setResonanceDaoDivideIntoScale(BigDecimal resonanceDaoDivideIntoScale) {
        if (Objects.nonNull(resonanceDaoDivideIntoScale)){
            this.resonanceDaoDivideIntoScale = resonanceDaoDivideIntoScale.setScale(2,BigDecimal.ROUND_DOWN);
        }
    }

    public void setResonanceServiceCenterDaoDivideIntoScale(BigDecimal resonanceServiceCenterDaoDivideIntoScale) {
        if (Objects.nonNull(resonanceServiceCenterDaoDivideIntoScale)){
            this.resonanceServiceCenterDaoDivideIntoScale = resonanceServiceCenterDaoDivideIntoScale.setScale(2,BigDecimal.ROUND_DOWN);
        }
    }

    public void setType(EcologyHatchShareProfitTypeEnum type) {
        this.type = type;
        this.typeName = type.getDescription();
    }
}
